import { Pipe, PipeTransform } from "@angular/core";

@Pipe({
  name: "filterList"
})
export class FilterListPipe implements PipeTransform {
  transform(items: any[], key, field): any {
    return key
      ? items.filter(n => {
          return (
            n.mobile.toString().indexOf(key) > -1 ||
            n.nickname.toString().indexOf(key) > -1
          );
        })
      : items;
  }
}
